using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using ShopForWeb.Model.Basic;
using ShopForWeb.Model.DBContexts;

namespace ShopForWeb.Services
{
    public class UserService
    {
      private ShopDBContext   _db;
        public UserService(ShopDBContext db)//注入
    {
      _db = db;
    }

        public async Task<User?> GetByLoginAsync(string phone,string password)
        {
            var query =_db.UserSet
            .Where(u=>u.Phone==phone&&u.Password==password);
            return await query.FirstOrDefaultAsync();
        }
    }
}